package Practice.Practice_02.LoginAndRegistration;

import java.util.Objects;
import java.util.Scanner;

public class Registration {
    public Registration(){

    }
    public static void registration(Account[] acc){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入账号：");
        String user = sc.next();
        System.out.println("请输入密码：");
        String pass = sc.next();
        for (int i = 0; i < acc.length; i++) {
            if(Objects.equals(acc[i].getUsername(), "-1")){
                acc[i].setUsername(user);
                acc[i].setPassword(pass);
                System.out.println("注册成功！");
                break;
            }else if (Objects.equals(acc[i].getUsername(),user)) {
                System.out.println("该账号已注册！");
                break;
            }
        }
    }
}
